<VirtualHost {{ ips.map{|ip| ip + ":80"}.join(" ") }}>
  ServerName {{ name }}
{% if  not server_aliases.empty? -%}
  ServerAlias {{ server_aliases.join(" ") }}
<% end -%>
  ServerAdmin {{ server_admin }}
  TraceEnable Off

{% if  gzip -%}
  SetOutputFilter DEFLATE
<% end -%>

{% if  sslonly -%}
  RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [NE]
<% else -%>
  Include "conf.d/{{ name }}/*.conf"
<% end -%>
</VirtualHost>

{% if  ssl -%}
<VirtualHost {{ ips.map{|ip| ip + ":443"}.join(" ") }}>
  ServerName {{ name }}
{% if  not server_aliases.empty? -%}
  ServerAlias {{ server_aliases.join(" ") }}
<% end -%>
  ServerAdmin {{ server_admin }}

{% if  gzip -%}
  SetOutputFilter DEFLATE
<% end -%>

  SSLEngine on
  SSLCertificateFile /etc/pki/tls/certs/{{ cert_name }}.cert
  SSLCertificateKeyFile /etc/pki/tls/private/{{ cert_name }}.key
{% if  not sSLCertificateChainFile.empty? -%}
  SSLCertificateChainFile /etc/pki/tls/certs/{{ sSLCertificateChainFile }}
<% end -%>
  SSLHonorCipherOrder On

  # https://fedorahosted.org/fedora-infrastructure/ticket/4101#comment:14
  # If you change the protocols or cipher suites, you should probably update
  # modules/squid/files/squid.conf-el6 too, to keep it in sync.
  SSLProtocol {{ ssl_protocols }}
  SSLCipherSuite {{ ssl_ciphers }}

  Include "conf.d/{{ name }}/*.conf"
</VirtualHost>
<% end -%>
